﻿using System;
using System.Data;
using System.Collections.Generic;
using ElingOA6_DSJCJ.Model;
namespace ElingOA6_DSJCJ.BLL
{
	/// <summary>
	/// LeadInstruct
	/// </summary>
	public partial class LeadInstruct
	{
		private readonly ElingOA6_DSJCJ.DAL.LeadInstruct dal=new ElingOA6_DSJCJ.DAL.LeadInstruct();
		public LeadInstruct()
		{}
		#region  Method
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(decimal FDocId,string FDeptNo,string FEntityNo,string FEmplNo)
		{
			return dal.Exists(FDocId,FDeptNo,FEntityNo,FEmplNo);
		}
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(decimal FDocId, string FEntityNo)
        {
            return dal.Exists(FDocId, FEntityNo);
        }
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(ElingOA6_DSJCJ.Model.LeadInstruct model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ElingOA6_DSJCJ.Model.LeadInstruct model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(decimal FDocId,string FDeptNo,string FEntityNo,string FEmplNo)
		{
			
			return dal.Delete(FDocId,FDeptNo,FEntityNo,FEmplNo);
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public ElingOA6_DSJCJ.Model.LeadInstruct GetModel(decimal FDocId,string FDeptNo,string FEntityNo,string FEmplNo)
		{
			
			return dal.GetModel(FDocId,FDeptNo,FEntityNo,FEmplNo);
		}


		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return dal.GetList(Top,strWhere,filedOrder);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ElingOA6_DSJCJ.Model.LeadInstruct> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ElingOA6_DSJCJ.Model.LeadInstruct> DataTableToList(DataTable dt)
		{
			List<ElingOA6_DSJCJ.Model.LeadInstruct> modelList = new List<ElingOA6_DSJCJ.Model.LeadInstruct>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				ElingOA6_DSJCJ.Model.LeadInstruct model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new ElingOA6_DSJCJ.Model.LeadInstruct();
					if(dt.Rows[n]["FDocId"]!=null && dt.Rows[n]["FDocId"].ToString()!="")
					{
						model.FDocId=decimal.Parse(dt.Rows[n]["FDocId"].ToString());
					}
					if(dt.Rows[n]["FDeptNo"]!=null && dt.Rows[n]["FDeptNo"].ToString()!="")
					{
					model.FDeptNo=dt.Rows[n]["FDeptNo"].ToString();
					}
					if(dt.Rows[n]["FEntityNo"]!=null && dt.Rows[n]["FEntityNo"].ToString()!="")
					{
					model.FEntityNo=dt.Rows[n]["FEntityNo"].ToString();
					}
					if(dt.Rows[n]["FEmplNo"]!=null && dt.Rows[n]["FEmplNo"].ToString()!="")
					{
					model.FEmplNo=dt.Rows[n]["FEmplNo"].ToString();
					}
					if(dt.Rows[n]["FExamineDate"]!=null && dt.Rows[n]["FExamineDate"].ToString()!="")
					{
						model.FExamineDate=DateTime.Parse(dt.Rows[n]["FExamineDate"].ToString());
					}
					if(dt.Rows[n]["FExamineIP"]!=null && dt.Rows[n]["FExamineIP"].ToString()!="")
					{
					model.FExamineIP=dt.Rows[n]["FExamineIP"].ToString();
					}
					if(dt.Rows[n]["FExamineContent"]!=null && dt.Rows[n]["FExamineContent"].ToString()!="")
					{
					model.FExamineContent=dt.Rows[n]["FExamineContent"].ToString();
					}
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}

		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			return dal.GetRecordCount(strWhere);
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			return dal.GetListByPage( strWhere,  orderby,  startIndex,  endIndex);
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  Method
	}
}

